<?php
class IndexAction extends Action{
	public function Index(){
         if(!$list=S("index_list")){
       	    echo '缓存更新成功!';
			//p($_GET['id']);die;
			$field=array('id','name','pid');
			$list=M('cate')->where(array('pid'=>0))->field($field)->select();
	      //  p($topCate);die();
	        $cates=M('cate')->field($field)->select();
	        import('Class.Category',APP_PATH);
	        foreach ($list as $k => $v) {
	        	$cid=Category::getChildsId($cates,$v['id']);
	            $cid[]=$v['id'];
	            $list[$k]['blog']=M('blog')->order("time DESC")->limit(3)->where(array('cid'=>array('IN',$cid)))->select();

	        }    
	        S('index_list',$list,10);
          }
        $this->list= $list;
		$this->display();
	}
}


?>